home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / VideoToolbox 96.06.15 / VideoToolboxSources / DrawPrintf.c < prev    next >
Text File  |  1993-02-23  |  564b  |  28 lines

  1. /* DrawPrintf.c
  2. This does a sprintf and draws the characters into the current port, 
  3. using the current font etc. 
  4. */
  5. #include "VideoToolbox.h"
  6. #include <stdarg.h>      /* for variable-number-of-argument macros */
  7.  
  8. void DrawPrintf(char *s, ...)
  9. {
  10.     va_list args;
  11.     char string[400];
  12.     int i;
  13.     Point pt;
  14.     FontInfo info;
  15.   
  16.     va_start(args, s);
  17.     vsprintf(string,s,args);
  18.     va_end(args);
  19.     for(i=0;i<strlen(string);i++){
  20.         if(string[i]=='\n'){
  21.             GetPen(&pt);
  22.             GetFontInfo(&info);
  23.             Move(-pt.h,info.leading+info.ascent+info.descent);
  24.         }
  25.         else DrawChar(string[i]);
  26.     }
  27. }
  28.